//
//  TravelLXDCollectionViewCell.m
//  ToWhere
//
//  Created by dllo on 15/11/19.
//  Copyright © 2015年 www.TE.com. All rights reserved.
//

#import "TravelLXDCollectionViewCell.h"
#import <SDWebImageManager.h>
#import <UIImageView+WebCache.h>
@implementation TravelLXDCollectionViewCell

- (void)dealloc
{
    [_dic release];
    [_imageV release];
    [_label release];
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    if (self) {
        self.imageV = [[UIImageView alloc] init];
        [self.contentView addSubview:_imageV];
        [_imageV release];
        
        self.label = [[UILabel alloc] init];
        self.label.textAlignment = NSTextAlignmentCenter;
        self.label.backgroundColor = [UIColor whiteColor];
        self.label.textColor = [UIColor colorWithWhite:0.324 alpha:1.000];
        self.label.font = [UIFont systemFontOfSize:17 *kWidth];
        [self.contentView addSubview:_label];
        [_label release];
    }
    return self;
}
- (void)setDic:(NSDictionary *)dic{

    if (_dic != dic) {
        [_dic release];
        _dic = [dic retain];
    }
    if ([[dic objectForKey:@"image_url"] isKindOfClass:[NSNull class]]) {
        return;
    }
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:[dic objectForKey:@"image_url"]] placeholderImage:[UIImage imageNamed:@"placeHoder"]];
    self.label.text = [dic objectForKey:@"name"];
}
- (void)layoutSubviews{

    [super layoutSubviews];
    
    self.imageV.frame = CGRectMake(0, 0, self.frame.size.width, 100 *kHeight);
    self.label.frame = CGRectMake(0, 100 *kHeight, self.frame.size.width, 25 *kHeight);
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
